package redis

import (
	"time"

	"ezgin-example/i18n"

	"github.com/loebfly/ezgin"
)

type templateRds struct{}

func (receiver templateRds) Insert(key string, value interface{}, expiration time.Duration) error {
	rds, err := ezgin.DBLite.Redis()
	if err != nil {
		return i18n.DbConnectErr.Error()
	}
	err = rds.Set(key, value, expiration).Err()
	if err != nil {
		return i18n.DbInsertErr.ErrorWithMsg(err.Error())
	}
	return nil
}
